﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Sepia : Ship
{
    public GameObject m_ProjectilePerfab;
    public GameObject m_EmitPoint;
    public ParticleSystem m_DarkFog;

    public float m_DurationTimeMax = 12;
    protected new void Start()
    {
        base.Start();
    }

    // Update is called once per frame
    protected new void Update()
    {
        base.Update();

    }
    public override bool LaunchSkill()
    {
        if (!base.LaunchSkill())
            return false;

        AddForce(transform.up, 800);

        var missleObj = Instantiate(m_ProjectilePerfab);
        var missleCom = missleObj.GetComponent<FlyItem>();

        if (UtilsGame.IsOnline() && UtilsGame.IsServer(this.gameObject))
        {
            UtilsGame.SpawnInServer(missleObj);
        }
        if (missleCom)
           missleCom.InitParameter(m_EmitPoint.transform.position, -transform.up, 3, 7, 180, "", Weapon.DamageType.TYPE_EXPLOSION, this, null);


        ParticleSystem darkFog = Instantiate(m_DarkFog.gameObject).GetComponent<ParticleSystem>();
        darkFog.transform.position = m_EmitPoint.transform.position;
        darkFog.Play();
        Destroy(darkFog.gameObject, darkFog.main.duration);


        return true;
    }
    public override void OnChase()
    {
    }
    public override void OnFight()
    {
    }
    public override void OnRetreat()
    {
        if (SkillIsReady)
            LaunchSkill();
    }
}
